const mysql = require('../config/db')
const { DataTypes } = require('sequelize')
require('dotenv').config()

const Setting = mysql.define(
  'setting',
  {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      autoIncrement: true,
    },
    websiteName: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    subtitle: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    logo: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    description: {
      type: DataTypes.TEXT,
      allowNull: false,
    },
    keyWord: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    icon: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    seoTitle: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    metaDesc: {
      type: DataTypes.TEXT,
      allowNull: false,
    },
    sysIsComment: {
      type: DataTypes.ENUM('Y', 'N'),
      allowNull: false,
      defaultValue: 'Y',
    },
    sysSComment: {
      type: DataTypes.ENUM('Y', 'N'),
      allowNull: false,
      defaultValue: 'N',
    },
    sysIsRegister: {
      type: DataTypes.ENUM('Y', 'N'),
      allowNull: false,
      defaultValue: 'N',
    },
    copyright: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    icp: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    pub: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    robots: {
      type: DataTypes.TEXT,
      allowNull: false,
      defaultValue: 'User-agent: *\nAllow: /',
    },
  },
  {
    tableName: 'setting',
    timestamps: false,
  },
)
module.exports = Setting
